<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>numpy.polyint &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/language_data.js"></script>
    <script type="text/javascript" src="../../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../../about.html" >
    <link rel="index" title="Index" href="../../genindex.html" >
    <link rel="search" title="Search" href="../../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../../index.html" >
    <link rel="up" title="Poly1d" href="../routines.polynomials.poly1d.html" >
    <link rel="next" title="numpy.polyadd" href="numpy.polyadd.html" >
    <link rel="prev" title="numpy.polyder" href="numpy.polyder.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../../index.html">
      <img border=0 alt="NumPy" src="../../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="../index.html" >NumPy Reference</a></li>
          <li class="active"><a href="../routines.html" >Routines</a></li>
          <li class="active"><a href="../routines.polynomials.html" >Polynomials</a></li>
          <li class="active"><a href="../routines.polynomials.poly1d.html" accesskey="U">Poly1d</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="numpy.polyadd.html" title="numpy.polyadd"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="numpy.polyder.html" title="numpy.polyder"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="numpy.polyder.html"
                        title="previous chapter">numpy.polyder</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="numpy.polyadd.html"
                        title="next chapter">numpy.polyadd</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <div class="section" id="numpy-polyint">
<h1>numpy.polyint<a class="headerlink" href="#numpy-polyint" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="numpy.polyint">
<code class="sig-prename descclassname">numpy.</code><code class="sig-name descname">polyint</code><span class="sig-paren">(</span><em class="sig-param">p</em>, <em class="sig-param">m=1</em>, <em class="sig-param">k=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/numpy/numpy/blob/v1.18.1/numpy/lib/polynomial.py#L258-L350"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numpy.polyint" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an antiderivative (indefinite integral) of a polynomial.</p>
<p>The returned order <em class="xref py py-obj">m</em> antiderivative <em class="xref py py-obj">P</em> of polynomial <em class="xref py py-obj">p</em> satisfies
<img class="math" src="../../_images/math/5bcfcc8f3fdaa8134d8c77f14cf42514f1ae818e.svg" alt="\frac{d^m}{dx^m}P(x) = p(x)"/> and is defined up to <em class="xref py py-obj">m - 1</em>
integration constants <em class="xref py py-obj">k</em>. The constants determine the low-order
polynomial part</p>
<div class="math">
<p><img src="../../_images/math/d52d822f969b0ba3a4f9f0350dc420fc44ff5696.svg" alt="\frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1}"/></p>
</div><p>of <em class="xref py py-obj">P</em> so that <img class="math" src="../../_images/math/744aec3b2b93f09c1d147e305cc292606f1a00e9.svg" alt="P^{(j)}(0) = k_{m-j-1}"/>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>p</strong><span class="classifier">array_like or poly1d</span></dt><dd><p>Polynomial to integrate.
A sequence is interpreted as polynomial coefficients, see <a class="reference internal" href="numpy.poly1d.html#numpy.poly1d" title="numpy.poly1d"><code class="xref py py-obj docutils literal notranslate"><span class="pre">poly1d</span></code></a>.</p>
</dd>
<dt><strong>m</strong><span class="classifier">int, optional</span></dt><dd><p>Order of the antiderivative. (Default: 1)</p>
</dd>
<dt><strong>k</strong><span class="classifier">list of <em class="xref py py-obj">m</em> scalars or scalar, optional</span></dt><dd><p>Integration constants. They are given in the order of integration:
those corresponding to highest-order terms come first.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">None</span></code> (default), all constants are assumed to be zero.
If <em class="xref py py-obj">m = 1</em>, a single scalar can be given instead of a list.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="numpy.polyder.html#numpy.polyder" title="numpy.polyder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">polyder</span></code></a></dt><dd><p>derivative of a polynomial</p>
</dd>
<dt><a class="reference internal" href="numpy.poly1d.integ.html#numpy.poly1d.integ" title="numpy.poly1d.integ"><code class="xref py py-obj docutils literal notranslate"><span class="pre">poly1d.integ</span></code></a></dt><dd><p>equivalent method</p>
</dd>
</dl>
</div>
<p class="rubric">Examples</p>
<p>The defining property of the antiderivative:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">poly1d</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">polyint</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span>
<span class="go"> poly1d([ 0.33333333,  0.5       ,  1.        ,  0.        ]) # may vary</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">polyder</span><span class="p">(</span><span class="n">P</span><span class="p">)</span> <span class="o">==</span> <span class="n">p</span>
<span class="go">True</span>
</pre></div>
</div>
<p>The integration constants default to zero, but can be specified:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">P</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">polyint</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">0.0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">polyder</span><span class="p">(</span><span class="n">P</span><span class="p">)(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">0.0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">polyder</span><span class="p">(</span><span class="n">P</span><span class="p">,</span> <span class="mi">2</span><span class="p">)(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">0.0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">polyint</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">k</span><span class="o">=</span><span class="p">[</span><span class="mi">6</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span>
<span class="go">poly1d([ 0.01666667,  0.04166667,  0.16666667,  3. ,  5. ,  3. ]) # may vary</span>
</pre></div>
</div>
<p>Note that 3 = 6 / 2!, and that the constants are given in the order of
integrations. Constant of the highest-order polynomial term comes first:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">polyder</span><span class="p">(</span><span class="n">P</span><span class="p">,</span> <span class="mi">2</span><span class="p">)(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">6.0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">polyder</span><span class="p">(</span><span class="n">P</span><span class="p">,</span> <span class="mi">1</span><span class="p">)(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">5.0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">3.0</span>
</pre></div>
</div>
</dd></dl>

</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>